package com.bartender.ingredient.service.impl;

import java.util.List;

import com.bartender.common.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bartender.ingredient.mapper.IngredientMapper;
import com.bartender.ingredient.domain.Ingredient;
import com.bartender.ingredient.service.IIngredientService;

/**
 * 原料管理Service业务层处理
 * 
 * @author bartender
 * @date 2024-11-22
 */
@Service
public class IngredientServiceImpl implements IIngredientService 
{
    @Autowired
    private IngredientMapper ingredientMapper;

    /**
     * 查询原料管理
     * 
     * @param ingredientId 原料管理主键
     * @return 原料管理
     */
    @Override
    public Ingredient selectIngredientByIngredientId(Long ingredientId)
    {
        return ingredientMapper.selectIngredientByIngredientId(ingredientId);
    }

    /**
     * 查询原料管理列表
     * 
     * @param ingredient 原料管理
     * @return 原料管理
     */
    @DataScope(deptAlias = "i")
    @Override
    public List<Ingredient> selectIngredientList(Ingredient ingredient)
    {
        return ingredientMapper.selectIngredientList(ingredient);
    }

    @Override
    public List<Ingredient> selectIngredientListFront(Ingredient ingredient) {
        return ingredientMapper.selectIngredientListFront(ingredient);
    }

    /**
     * 新增原料管理
     * 
     * @param ingredient 原料管理
     * @return 结果
     */
    @Override
    public int insertIngredient(Ingredient ingredient)
    {
        return ingredientMapper.insertIngredient(ingredient);
    }

    /**
     * 修改原料管理
     * 
     * @param ingredient 原料管理
     * @return 结果
     */
    @Override
    public int updateIngredient(Ingredient ingredient)
    {
        return ingredientMapper.updateIngredient(ingredient);
    }

    /**
     * 批量删除原料管理
     * 
     * @param ingredientIds 需要删除的原料管理主键
     * @return 结果
     */
    @Override
    public int deleteIngredientByIngredientIds(Long[] ingredientIds)
    {
        return ingredientMapper.deleteIngredientByIngredientIds(ingredientIds);
    }

    /**
     * 删除原料管理信息
     * 
     * @param ingredientId 原料管理主键
     * @return 结果
     */
    @Override
    public int deleteIngredientByIngredientId(Long ingredientId)
    {
        return ingredientMapper.deleteIngredientByIngredientId(ingredientId);
    }
}
